//
//  PKIMViewControllerCell.swift
//  Panku
//
//  Created by mac on 2017/2/13.
//  Copyright © 2017年 Monster. All rights reserved.
//

import UIKit
import SnapKit

class PKIMViewControllerCell: PKBaseTableViewCell {

    //MARK: - properties
    //UI
    lazy var avatarView = UIImageView()
    lazy var nameView = UILabel()
    lazy var messageView = UILabel()
    lazy var dateView = UILabel()
    
    lazy var badgeLabel = UILabel()
    
    override func setupCell() -> Void{
        contentView.addSubview(avatarView)
        contentView.addSubview(nameView)
        contentView.addSubview(messageView)
        contentView.addSubview(dateView)
        
        contentView.addSubview(badgeLabel)
        
        avatarView.layer.masksToBounds = true
        avatarView.layer.cornerRadius = 15
        avatarView.image = R.image.mine_logo()
        avatarView.backgroundColor = UIColor.black
        avatarView.snp.makeConstraints { (make) in
            make.centerY.equalTo(contentView.snp.centerY)
            make.width.equalTo(30)
            make.height.equalTo(30)
            make.left.equalTo(contentView.snp.left).offset(10)
        }
        
        nameView.font = UIFont.systemFont(ofSize: 14)
        nameView.textColor = UIColor.black
        nameView.text = "funk放克"
        nameView.snp.makeConstraints { (make) in
            make.top.equalTo(contentView.snp.top).offset(2)
            make.left.equalTo(avatarView.snp.right).offset(10)
            
        }
        
        messageView.font = UIFont.systemFont(ofSize: 14)
        messageView.numberOfLines = 1
        messageView.textColor = UIColor.darkGray
        messageView.text = "放克官方客服受理您的购买申请放克官方客服受理您的购买申请放克官方客服受理您的购买申请放克官方客服受理您的购买申请放克官方客服受理您的购买申请"
        messageView.snp.makeConstraints { (make) in
            make.left.equalTo(nameView.snp.left)
            make.right.equalTo(contentView.snp.right)
            make.top.equalTo(nameView.snp.bottom).offset(2)
        }
        
        dateView.font = UIFont.systemFont(ofSize: 14)
        dateView.textColor = UIColor.darkGray
        dateView.text = "星期四"
        dateView.snp.makeConstraints { (make) in
            make.bottom.equalTo(messageView.snp.top)
            make.right.equalTo(contentView.snp.right).offset(-7)
        }
        
        badgeLabel.textAlignment = .center
        badgeLabel.text = "3"
        badgeLabel.font = UIFont.systemFont(ofSize: 14)
        badgeLabel.layer.masksToBounds = true
        badgeLabel.layer.cornerRadius = 8
        badgeLabel.textColor = UIColor.white
        badgeLabel.backgroundColor = UIColor.red
        badgeLabel.snp.makeConstraints { (make) in
            make.centerY.equalTo(avatarView.snp.top).offset(2)
            make.centerX.equalTo(avatarView.snp.right).offset(-2)
            make.width.equalTo(16)
            make.height.equalTo(16)
        }
    }

}
